quartz: implement gdk_window_set_shadow_width()
authorRyan Lortie <desrt@desrt.ca>
Fri, 13 Dec 2013 04:31:52 +0000 (23:31 -0500)
committerRyan Lortie <desrt@desrt.ca>
Mon, 6 Jan 2014 20:27:28 +0000 (15:27 -0500)
Use the information to allow dragging windows all the way to the top of
the screen (ie: allow the top shadow to go under the menubar).

https://bugzilla.gnome.org/show_bug.cgi?id=720374

gdk/quartz/GdkQuartzNSWindow.c
gdk/quartz/gdkwindow-quartz.c
gdk/quartz/gdkwindow-quartz.h

index df96a260ed7705c321b3cf0bce9ba53100d4fe87..8ab09ebea7797880c4a8fc10d5babdae28950b40 100644 (file)
 
 - (BOOL)trackManualMove
 {
+  GdkWindow *window = [[self contentView] gdkWindow];
+  GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
   NSPoint currentLocation;
   NSPoint newOrigin;
   NSRect screenFrame = [[NSScreen mainScreen] visibleFrame];
   newOrigin.y = currentLocation.y - initialMoveLocation.y;
 
   /* Clamp vertical position to below the menu bar. */
-  if (newOrigin.y + windowFrame.size.height > screenFrame.origin.y + screenFrame.size.height)
-    newOrigin.y = screenFrame.origin.y + screenFrame.size.height - windowFrame.size.height;
+  if (newOrigin.y + windowFrame.size.height - impl->shadow_top > screenFrame.origin.y + screenFrame.size.height)
+    newOrigin.y = screenFrame.origin.y + screenFrame.size.height - windowFrame.size.height + impl->shadow_top;
 
   [self setFrameOrigin:newOrigin];
 
index 05b3b77beb9aa20b2ebdc3c50c35e317a40a62db..27ef1a5db36ba8487a2aa56082939052a33f8ada 100644 (file)
@@ -2887,6 +2887,25 @@ gdk_quartz_window_set_opacity (GdkWindow *window,
   [impl->toplevel setAlphaValue: opacity];
 }
 
+static void
+gdk_quartz_window_set_shadow_width (GdkWindow *window,
+                                    gint       left,
+                                    gint       right,
+                                    gint       top,
+                                    gint       bottom)
+{
+  GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
+
+  g_return_if_fail (GDK_IS_WINDOW (window));
+  g_return_if_fail (WINDOW_IS_TOPLEVEL (window));
+
+  if (GDK_WINDOW_DESTROYED (window) ||
+      !WINDOW_IS_TOPLEVEL (window))
+    return;
+
+  impl->shadow_top = top;
+}
+
 static cairo_region_t *
 gdk_quartz_window_get_shape (GdkWindow *window)
 {
@@ -3000,6 +3019,7 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
   impl_class->begin_resize_drag = gdk_quartz_window_begin_resize_drag;
   impl_class->begin_move_drag = gdk_quartz_window_begin_move_drag;
   impl_class->set_opacity = gdk_quartz_window_set_opacity;
+  impl_class->set_shadow_width = gdk_quartz_window_set_shadow_width;
   impl_class->destroy_notify = gdk_quartz_window_destroy_notify;
   impl_class->register_dnd = _gdk_quartz_window_register_dnd;
   impl_class->drag_begin = _gdk_quartz_window_drag_begin;
index dcd75b08d027bc7516a52f2ef683c2b7daf561d5..396035d331f45dcb247d5b40bf4c9baa31dcb07d 100644 (file)
@@ -62,6 +62,8 @@ struct _GdkWindowImplQuartz
   cairo_region_t *needs_display_region;
 
   cairo_surface_t *cairo_surface;
+
+  gint shadow_top;
 };
  
 struct _GdkWindowImplQuartzClass